﻿namespace Wips.Domain.Models
{
    /// <summary>
    /// 发布流程节点
    /// </summary>
    [SugarTable("publish_flow_node")]
    public class PublishFlowNode : ValueObjectBase
    {

        /// <summary>
        /// 归属流程任务
        /// </summary>
        public string PublishFlowId { get; set; } = "";


        /// <summary>
        /// 归属流程
        /// </summary>
        [Navigate(NavigateType.ManyToOne, nameof(PublishFlowId))]
        public PublishFlow? PublishFlow { get; set; }

        /// <summary>
        /// 节点类型
        /// </summary>
        public EnumNodeType NodeType { get; set; }


        /// <summary>
        /// 节点结果值
        /// </summary>
        public string Result { get; set; } = "";


        /// <summary>
        /// 节点状态
        /// </summary>
        public EnumNodeStatus NodeStatus { get; set; }



    }

    /// <summary>
    /// 节点类型
    /// </summary>
    public enum EnumNodeType
    {

        /// <summary>
        /// 备份
        /// </summary>
        BackUp = 1,

        /// <summary>
        /// 上传
        /// </summary>
        Upload = 2,


        /// <summary>
        /// 上传/覆盖
        /// </summary>
        Publish = 3,

        /// <summary>
        /// 执行脚本
        /// </summary>
        RunScript = 4,

        /// <summary>
        /// 还原（不在这个表，日志记录有）
        /// </summary>
        Restore = 5,

        /// <summary>
        /// 还原（不在这个表，日志记录有）
        /// </summary>
        SaveFile = 6
    }

    /// <summary>
    /// 节点状态
    /// </summary>
    public enum EnumNodeStatus
    {

        /// <summary>
        /// 成功
        /// </summary>
        Success = 1,

        /// <summary>
        /// 进行中
        /// </summary>
        Progress = 2,


        /// <summary>
        /// 失败
        /// </summary>
        Fail = 3

    }
}
